package com.hand.wfive.activity

import android.content.Context
import com.hand.wfive.R
import com.hand.wfive.base.BaseActivity
import com.hand.wfive.loginAndVip.UserManager
import com.hand.wfive.loginAndVip.ui.LoginIndexActivity
import com.hand.wfive.util.click.singleClick
import kotlinx.android.synthetic.main.activity_user_info_collect.topBar
import kotlinx.android.synthetic.main.activity_user_info_collect.tvUserDevice
import kotlinx.android.synthetic.main.activity_user_info_collect.tvUserIdCardInfo
import kotlinx.android.synthetic.main.activity_user_info_collect.tvUserInfo
import kotlinx.android.synthetic.main.activity_user_info_collect.tvUserServiceInfo
import org.jetbrains.anko.startActivity


class UserInfoCollectActivity : BaseActivity() {

    companion object {
        fun show(context: Context) {
            if (UserManager.getInstance().isLogin) {
                context.startActivity<UserInfoCollectActivity>()
            } else {
                LoginIndexActivity.show(context, false)
            }
        }
    }

    override fun getContentViewId(): Int = R.layout.activity_user_info_collect

    override fun init() {
        topBar.setTitle("个人信息收集清单")
        topBar.addLeftBackImageButton().singleClick { finish() }

        setListener()
    }

    private fun setListener() {
        tvUserInfo.singleClick {
            PrivacyActivity.showRule(this, PrivacyActivity.PolicyUserInfoList)
        }
        tvUserIdCardInfo.singleClick {
            PrivacyActivity.showRule(this, PrivacyActivity.PolicyUserIdCardInfo)
        }
        tvUserServiceInfo.singleClick {
            PrivacyActivity.showRule(this, PrivacyActivity.PolicyUserServiceInfo)
        }
        tvUserDevice.singleClick {
            PrivacyActivity.showRule(this, PrivacyActivity.PolicyUserDeviceInfo)
        }
    }


}